<?php
/* @var $this CmpDepositController */
/* @var $model CmpDeposit */

$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'客户服务'=>array($this->pre_module_url.'/cmpServices/admin'),
	'退款管理'=>array($this->pre_module_url.'/refund/admin'),
	'确认退款'
);

?>
<div class="hr_15"></div>
<div class="steps">
	<ul class="fs_14 c_f">
		<li class="done done_a first"><span class="one">第一步,买家投诉申请</span></li>
		<li class="cur"><span class="two">第二步，卖家处理投诉</span></li>
		<li class="last"><span class="three">第三步，投诉完成</span></li> 
	</ul>
</div>
<div class="hr_20"></div>
<!--投诉管理 start-->
<div class="complain_box step_box">    
	<div class="step_info">
		<div class="step_status">
			<div class="status">
				<?php if($model->zmr_status==1){?>
				<p><span class="ico_big ico_done"></span><strong class="fs_14">投诉已提交，等待卖家申诉</strong></p>
				<p class="c_999">还剩 <span id='countdown'><?php echo 3600*7*24-(time()-$model->inputtime)?></span> 申诉时间，如果过期还未申诉，商城客服将裁定买家投诉成功！</p>
				<?php }else{?>
				<p><span class="ico_big ico_done"></span><strong class="fs_14">申诉成功，等待商城客服处理</strong></p>
				<p class="c_999">商城客服将在48小时之内处理本次投诉。</p>
				<?php }?>
			</div>
		</div>
		<?php if($model->zmr_status==1){?>
		<div class="info">
			<?php $form=$this->beginWidget('CActiveForm', array(
					'id'=>'refund-form-form',
					'enableAjaxValidation'=>false,
				)); ?>
				<ul class="form_list"> 
					<li class="c_f"><span class="tit f_l">上传凭证：</span>
						<div class="cert_img f_l">
							<p class="c_999"><span class="ico ico_tip"></span><span>每张图片大小不能超过500K</span></p>
							<ul class="uploadimg c_f">
								<li class="f_l">
									<img id="img1" src="/images/cert_img.jpg" alt="" />
									<a class="mem_btn mem_btn10 filelink" href="javascript:" onclick="uploadimg('1')">点击上传
										<input type="file" id="uploadimg1" multiple name="image"/> 
									</a>
									<input type="hidden" id="proimage1" name="MemReport[zmr_cmp_pic][]" value="" />
								</li>
								<li class="f_l">
									<img id="img2" src="/images/cert_img.jpg" alt="" />
									<a class="mem_btn mem_btn10 filelink" href="javascript:" onclick="uploadimg('2')">点击上传
										<input type="file" id="uploadimg2" multiple name="image"/> 
									</a>
									<input type="hidden" id="proimage2" name="MemReport[zmr_cmp_pic][]" value="" />
								</li>
								<li class="f_l">
									<img id="img3" src="/images/cert_img.jpg" alt="" />
									<a class="mem_btn mem_btn10 filelink" href="javascript:" onclick="uploadimg('3')">点击上传
										<input type="file" id="uploadimg3" multiple name="image"/> 
									</a>
									<input type="hidden" id="proimage3" name="MemReport[zmr_cmp_pic][]" value="" />
								</li>
							</ul>
						</div>
					</li>
					<li><span class="tit">说明：</span></textarea><?php echo $form->textArea($model,'zmr_reply',array('class'=>'t_area'))?>
					</li>
					<li class="link">
						<span class="tit"></span>
						<?php echo CHtml::submitButton('同意退款',array('class'=>'mem_btn mem_btn05 mr5','name'=>'appeal'))?>
					</li>
				</ul>
			<?php $this->endWidget(); ?>
		</div>
		<?php }else{?>
		<div class="info">
			<ul class="form_list"> 
				<li class="c_f"><span class="tit f_l">上传凭证：</span>
					<div class="cert_img f_l">
						<ul class="c_f">
							<li><?php echo CHtml::image(!empty($model->zmr_cmp_pic[0])?$model->zmr_cmp_pic[0]:"/images/cert_img.jpg")?></li>
							<li><?php echo CHtml::image(!empty($model->zmr_cmp_pic[1])?$model->zmr_cmp_pic[1]:"/images/cert_img.jpg")?></li>
							<li><?php echo CHtml::image(!empty($model->zmr_cmp_pic[2])?$model->zmr_cmp_pic[2]:"/images/cert_img.jpg")?></li>
						</ul>
					</div>
				</li>
				<li><span class="tit">补充说明：</span><span><?php echo CHtml::encode($model->zmr_reply)?></span></li> 
			</ul>
		</div>
		<?php }?>
		<div class="info no_border">
			<h3>买家投诉信息</h3>
			<ul class="form_list">
				<li><span class="tit">投诉编号：</span><span><?php echo CHtml::encode($model->zmr_id)?></span></li>
				<li><span class="tit">投诉原因：</span><span><?php echo CHtml::encode(MemReport::model()->getTypeInfo($model->zmr_type_info))?></span></li>
				<li class="c_f"><span class="tit f_l">上传凭证：</span>
					<div class="cert_img f_l">
						<ul class="c_f">
							<li><?php echo CHtml::image(!empty($model->zmr_mem_pic[0])?$model->zmr_mem_pic[0]:"/images/cert_img.jpg")?></li>
							<li><?php echo CHtml::image(!empty($model->zmr_mem_pic[1])?$model->zmr_mem_pic[1]:"/images/cert_img.jpg")?></li>
							<li><?php echo CHtml::image(!empty($model->zmr_mem_pic[2])?$model->zmr_mem_pic[2]:"/images/cert_img.jpg")?></li>
						</ul>
					</div>
				</li>
				<li><span class="tit">补充说明：</span><span><?php echo CHtml::encode($model->zmr_content)?></span></li>
			</ul>
		</div>
	</div>
	<table class="list_table" cellpadding="0" cellspacing="0" width="100%">
		<tr>
			<th width="35%">宝贝信息</th>
			<th width="15%">卖家</th>
			<th width="12%">单价（元）</th>
			<th width="12%">数量</th>
			<th width="14%">优惠</th>
			<th width="12%">小计（元）</th>
		</tr>
		<?php if(empty($model->z_id)){foreach($model->order->orderProduct as $val)?>
		<tr>
			<td class="pro tl">
				<div class="c_img c_img50">
					<?php echo CHtml::link(Tool::thumb($val->zop_pic,50,50),array('/home/product/detail','id'=>$val->zp_id),array('style'=>'display: inline; width: 50px; height: 50px;'))?>
				</div>
				<p class="title_pro">
					<?php echo CHtml::link(mb_substr($val->zop_title,0,20),array('/home/product/detail','id'=>$val->zp_id),array('class'=>'c_06c'))?>
				</p>
			</td>
			<td>
				<a class="c_06c" href="javascript:" title=""><?php echo $val->member->zm_name?></a>
			</td>
			<td><?php echo $val->zop_price?></td>
			<td><?php echo $val->zop_nums?></td>
			<td><span class="agio"><?php echo number_format(($val->zop_price*$val->zop_nums)*10/$val->zop_real_price,1,'.','')?>折优惠</span></td>
			<td><span class="fw_b fs_14 c_f60"><?php echo $val->zop_real_price?></span></td>
		</tr>
		<?php } ?>
	</table>
</div>	
<!--投诉管理 end-->
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.ui.widget.js"></script>  
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.iframe-transport.js"></script>  
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.fileupload.js"></script>  
<script type="text/javascript">
//倒计时
jQuery(function(){
		countdown("countdown")
	});
//上传图片
function uploadimg (id) {
	   $('#uploadimg'+id).fileupload({         	
	        dataType: 'json',       
	        url: '/Attachment/GetAjax',        
	        success: function (json) {
	               if(json.upfile.errors=='1'){
	               		alert(json.upfile.msg);
	               }else if(json.upfile.errors=='2'){
	               		alert(json.upfile.msg);
	               }else{
		                 //修改按钮图标
		            	 $('#img'+id).attr('src',json.upfile.file);
						 //修改按钮文本
		            	 $('#img'+id).parent().find('a').eq(0).html('修改图片<input type="file" id="uploadimg'+id+'" multiple name="image"/>');
		            	 //填加删除按钮
		            	 if(!$('#img'+id).parent().find('a')[1]){
		            		 $('#img'+id).parent().find('a').after('<a class="mem_btn mem_btn10" href="javascript:" onclick="removeimg(\''+id+'\')">删除图片</a>');
		            	 }
						 //修改隐藏域值
	               		 $('#proimage'+id).attr('value',json.upfile.file);
	               } 	
	        }
	    });
};
//删除图片
function removeimg(id){
	$('#img'+id).parent().find('a').eq(0).html('上传图片<input type="file" id="uploadimg'+id+'" multiple name="image"/>');
	$('#img'+id).parent().find('a').eq(1).remove();
	$('#img'+id).attr('src','/images/pro_img.jpg');
	$('#proimage'+id).attr('value','');
}
</script>

